<%@ page language="java" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/pf/tag" prefix="PF" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="<PF:basePath/>"/>
    <title>回答-${doc.doc.title}<PF:ParameterValue
            key="config.sys.title"/></title>
    <meta name="description" content='<PF:ParameterValue key="config.sys.mate.description"/>'>
    <meta name="keywords" content='<PF:ParameterValue key="config.sys.mate.keywords"/>'>
    <meta name="author"
          content='<PF:ParameterValue key="config.sys.mate.author"/>'>
    <meta name="robots" content="index,follow">
    <jsp:include page="../atext/include-web.jsp"></jsp:include>
    <link rel="stylesheet"
          href="<PF:basePath/>text/lib/kindeditor/themes/default/default.css"/>
    <script charset="utf-8"
            src="<PF:basePath/>text/lib/kindeditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="<PF:basePath/>text/lib/kindeditor/zh_CN.js"></script>
    <script charset="utf-8"
            src="<PF:basePath/>text/lib/super-validate/validate.js"></script>
</head>
<body>
<jsp:include page="../commons/head.jsp"></jsp:include>
<jsp:include page="../commons/superContent.jsp"></jsp:include>
<div class="containerbox">
    <div class="container ">
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <jsp:include
                                        page="../qa/commons/doc.jsp"></jsp:include>
                            </div>
                        </div>
                    </div>
                </div>
                <form role="form" action="qa/addmsg.do" id="knowSubmitFormId"
                      method="post">
                    <input type="hidden" name="docid" value="${doc.doc.id}"/>
                    <div class="row">
                        <div class="col-md-12">
                            <div class="form-group">
									<textarea class="form-control" id="mesTextId" name="content"
                                              placeholder="请输入回答内容"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-2">
                            <button type="button" id="msgSubmitButtonId"
                                    class="btn btn-primary">发表回答
                            </button>
                        </div>
                    </div>
                </form>
                <jsp:include page="commons/includeComments.jsp"></jsp:include>
            </div>
        </div>
    </div>
</div>
<jsp:include page="../commons/foot.jsp"></jsp:include>
</body>
<script type="text/javascript">
    $(function () {
        //分类
        $('.typetagsearch').bind('click', function () {
            luceneSearch('TYPE:' + $(this).attr('title'));
        });
        $('#msgSubmitButtonId')
            .bind(
                'click',
                function () {
                    if (!validate('knowSubmitFormId')) {
                        $('#errormessageShowboxId').text('信息录入有误，请检查！');
                    } else {
                        $('#knowSubmitFormId').submit();
                        $('#msgSubmitButtonId').hide();
                        $('#msgSubmitButtonId')
                            .before(
                                "<span class='label label-info glyphicon glyphicon-link'>提交中...</span>");
                    }
                });
        validateInput('mesTextId', function (id, val, obj) {
            // 留言
            if (valid_isNull(val)) {
                return {
                    valid: false,
                    msg: '评论内容不能为空'
                };
            }
            if (valid_maxLength(val, 128)) {
                return {
                    valid: false,
                    msg: '长度不能大于' + 128
                };
            }
            return {
                valid: true,
                msg: '正确'
            };
        });
    });

    function typeBoxGoPage(page) {
        window.location = basePath
            + 'qa/Pubmsg.do?docid=${doc.doc.id}&query.currentPage='
            + page;
    }
</script>
</html>